package easier.recycler;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.LayoutRes;

/**
 * 使用布局作为ViewHolder类型,并且生成界面
 */
public class BaseViewHolder extends TypeViewHolder {

    protected final @LayoutRes int mLayout; //布局

    public BaseViewHolder( @LayoutRes int layout ) {

        mLayout = layout;
    }

    @Override
    public View generateView( ViewGroup parent ) {

        return LayoutInflater.from( parent.getContext() ).inflate( mLayout, parent, false );
    }

    @Override
    public int getType() {

        return mLayout;
    }
}
